a = [1, 2, 3]
b = [4, 5, 6]
c = [4, 5, 6, 7, 8]
# 将可迭代的对象作为参数，将对象中对应的元素打包成一个个元组
zipped = zip(a, b)  # 返回一个对象
print(zipped)

print(list(zipped))
# [(1, 4), (2, 5), (3, 6)]
print(list(zip(a, c)))  # 元素个数与最短的列表一致
# [(1, 4), (2, 5), (3, 6)]
print("-" * 50)

a1, a2 = zip(*zip(a, b))  # 与 zip 相反，zip(*) 可理解为解压，返回二维矩阵式
print(a1, a2)
print(list(a1))
# [1, 2, 3]
print(list(a2))
# [4, 5, 6]
print("-" * 50)

x = [([1, 2, 3], [4, 5, 6])]
x1, x2 = zip(*x)
print(x1, x2)



